<template>
    <div class=login>
        <div>
            <div class="input">
                <div class="input-name">
                    <img src="../assets/img/index/login-name.png" alt="">
                    <input type="text" placeholder="请输入登录账号" v-model="uname">
                </div>
                 <div class="input-name">
                    <img src="../assets/img/index/login-wps.png" alt="">
                    <input type="text" placeholder="请输入您的密码" v-model="upwd">
                </div>
                 <div class="iptTop ">
                    <span class="checkbox" @click="correctNum=!correctNum" :class="{active:correctNum}"><img src="../assets/img/index/login-correct.png" alt=""></span>
                    <span class="rember">记住我</span>
                </div>
            </div>
            <div class="btnLogin">
                <button @click="login()">登录</button>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    data(){
        return{
           uname:'',
           upwd:'',
           correctNum:false,
        }
    },
    mounted(){
        console.log(1234,sessionStorage.getItem('uname'))
        if(localStorage.getItem("correctNum")){
            this.uname=localStorage.getItem('uname')
            this.upwd=localStorage.getItem('upwd')
            this.correctNum=localStorage.getItem('correctNum')
        }
    },
    methods:{
        // 登录
        login(){
            // this.axios.post('',{uname:this.uname,upwd:this.upwd}).then(res => {
            //     console.log(res)
            //     if(res.data.code==200){
            //         alert('登录成功')
            //         sessionStorage.setItem('islogin',true);
            //         sessionStorage.setItem('uname',this.uname);
            //         sessionStorage.setItem('upwd',this.upwd);
            //         sessionStorage.setItem('correctNum',this.correctNum);
            //         if(this.correctNum){
            //             localStorage.setItem("uname", this.uname);
            //             localStorage.setItem("upwd", this.upwd);
            //         }else{
            //             localStorage.setItem("uname", '');
            //             localStorage.setItem("upwd", '');
            //         }
            //         var payload=res.data
            //         payload.uname=this.uname
            //         payload.upwd=this.upwd
            //         payload.correctNum=this.correctNum
            //         this.$store.commit('login_mutation',payload)
            //         this.$router.push({path:'index'})
            //     }else{
            //         alert('登录失败')
            //     }
            // })
        },
    }
}

</script>
<style scoped>

</style>